﻿$(document).ready(function () {
    $.ajax(
        {
            url: "/Case/GetCaseCategoryList",
            success: function (data) {
                var result = data;
                var str = "<option value=\"{0}\">{1}</option>";
                var dd = "";
                $(result).each(function () {
                    var temp = this;
                    var html = str.replace("{0}", temp.ID).replace("{1}", temp.ClassName);
                    dd = dd + html;
                });
                $("#categoryID").html(dd);
            },
            error: function () {
            }
        }
    );
});
function Save() {
    var categoryID = $("#categoryID :checked").val();
    alert(categoryID);
    var html;
    html = KE.html('content');
    var title = $("#tb_title").val();
    if (title == "" || title == undefined) {
        alert("标题不能为空");
        return;
    }
    $.ajax({
        url: "/Case/AddArticle",
        data: { "title": title, "classID": categoryID, "Content": html },
        success: function (data) {
            if (data == 1) {
                alert("新增成功！");
            }
        },
        error: function (jqHR) {
            alert(jqHR + "新增文章失败");
        }

    });
}